<template>
  <ve-line :data="chartData" :settings="chartSettings" :legend-visible="legendVisible"
            theme-name="" width="100%" ></ve-line>
</template>

<script>

  import VeLine from 'v-charts/lib/line.common';

  export default {
    name: "HomeLine",
    components:{
      VeLine,
    },
    props: {
      rowsData: Array,
      lineTitle: String,    //图表标题
      code: String,  // 指数代码
    },
    // computed:{
    //   cChartData:function (){
    //     debugger
    //     console.info("homeline  中的computed")
    //     // this.chartData.rows = this.rowsData;
    //     this.chartData.rows = [{"tclose":3867.02,"tradedate":"2020-05-29"},{"tclose":3971.34,"tradedate":"2020-06-01"},{"tclose":3983.57,"tradedate":"2020-06-02"},{"tclose":3983.65,"tradedate":"2020-06-03"},{"tclose":3982.19,"tradedate":"2020-06-04"},{"tclose":4001.25,"tradedate":"2020-06-05"},{"tclose":4021.95,"tradedate":"2020-06-08"},{"tclose":4047.03,"tradedate":"2020-06-09"},{"tclose":4039.71,"tradedate":"2020-06-10"},{"tclose":3995.88,"tradedate":"2020-06-11"},{"tclose":4003.08,"tradedate":"2020-06-12"},{"tclose":3954.99,"tradedate":"2020-06-15"},{"tclose":4014.57,"tradedate":"2020-06-16"},{"tclose":4017.59,"tradedate":"2020-06-17"},{"tclose":4044.38,"tradedate":"2020-06-18"},{"tclose":4098.71,"tradedate":"2020-06-19"},{"tclose":4102.05,"tradedate":"2020-06-22"},{"tclose":4121.79,"tradedate":"2020-06-23"},{"tclose":4138.99,"tradedate":"2020-06-24"},{"tclose":4109.72,"tradedate":"2020-06-29"}]
    //     // console.info(this.chartData.rows);
    //   }
    // },
    data(){
        return {
          chartData: {
            columns: ['tradedate', 'tclose'],
            rows: this.rowsData,
          },
          legendVisible: false,  //是否显示图例
          chartSettings :{
            stack: { '指数名称': [this.lineTitle] },
            area: true
          },
          judgeWidth: false,
          chartEvents:{

          }
        }
    }
  }
</script>

<style scoped>

</style>
